package com.colinsage.spring.demo;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.colinsage.spring.domain.MessageSource;
import com.colinsage.spring.domain.User;

public class Sample {
	
	final static Log log = LogFactory.getLog(Sample.class);
	
	public static void main(String... args) {

		ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
	
		User u = (User) ctx.getBean("user2");
		
		log.info(u.getAddress().getName());
		log.info(u.getAge());
		
		MessageSource msg = (MessageSource) ctx.getBean("msgSource");
		log.info(msg.getUser());
	}
}
